public class Test {
    public static void main(String[] args) {
        int[] array={1,2,3,4,5,6};
        int left=0;
        int right=array.length-1;
        while (left < right) {
            while (left < right && array[left] % 2 != 0) {
                left++;
            }
            while (left < right && array[right] % 2 == 0) {
                right--;
            }
            if (left < right) {
                int temp = array[left];
                array[left] = array[right];
                array[right] = temp;
            }
        }
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
    }
    public static double avg(int[] arr){
        int sum=0;
        for(int i=0;i<arr.length;i++){
            sum+=arr[i];
        }
        return sum/arr.length;
    }
    public static void main4(String[] args) {
        int[] array={1,2,3,4,5};
        System.out.println(avg(array));
    }
    public static int sum(int[] arr){
        int sum=0;
        for(int i=0;i<arr.length;i++){
            sum+=arr[i];
        }
        return sum;
    }
    public static void main3(String[] args) {
        int[] array={1,2,3,4,5};
        System.out.println(sum(array));
    }
    public static void transform(int[] arr){
        for(int i=0;i<arr.length;i++){
            arr[i]*=2;
        }
    }
    public static void main2(String[] args){
        int[] array={1,2,3};
        transform(array);
        printArray(array);
    }
    public static void printArray(int[] arr){
        for(int i=0;i<arr.length;i++){
            System.out.print(arr[i]+" ");
        }
    }
    public static void main1(String[] args){
        int[] array={1,2,3,4,5};
        printArray(array);
    }
}
